import { SAVE_ACTION_TYPE, SAVE_SUBJECTS } from '../actions/bussiness/actionTypes'

type BussinessAction = { // 商业模块Action类型
  type: typeof SAVE_SUBJECTS | typeof SAVE_ACTION_TYPE
  payload: any
}

const initState = {
  subjects: [],
  actionType: ''
}

const bussiness = (state = initState, action: BussinessAction) => {
  const { type, payload } = action
  switch (type) {
    case SAVE_SUBJECTS:// 存储学科字典
      return { ...state, subjects: payload }

    case SAVE_ACTION_TYPE: // 存储公海池页面所用的标记
      return { ...state, actionType: payload }

    default:
      return state
  }
}

export default bussiness